]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
notificationDaemon: Try harder to find a matching app
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 29 May 2020 19:51:14 +0000 (21:51 +0200)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 2 Jun 2020 23:17:24 +0000 (23:17 +0000)
Unlike the desktop-entry hint, the app name is not optional. That
doesn't mean that we'll be able to match it to a .desktop file,
but we can at least try if we fail to match on PID or desktop-entry.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1291

js/ui/notificationDaemon.js

index 28fe8ba066bdb955e6feaf05a3d96463626f8b1b..3c8e90b1e0cccb4ce5f41cb3c880b64c71d970fb 100644 (file)
@@ -373,12 +373,11 @@ var FdoNotificationDaemonSource = GObject.registerClass(
 class FdoNotificationDaemonSource extends MessageTray.Source {
     _init(title, pid, sender, appId) {
         this.pid = pid;
+        this.initialTitle = title;
         this.app = this._getApp(appId);
 
         super._init(title);
 
-        this.initialTitle = title;
-
         if (this.app)
             this.title = this.app.get_name();
         else
@@ -426,19 +425,20 @@ class FdoNotificationDaemonSource extends MessageTray.Source {
     }
 
     _getApp(appId) {
+        const appSys = Shell.AppSystem.get_default();
         let app;
 
         app = Shell.WindowTracker.get_default().get_app_from_pid(this.pid);
         if (app != null)
             return app;
 
-        if (appId) {
-            app = Shell.AppSystem.get_default().lookup_app('%s.desktop'.format(appId));
-            if (app != null)
-                return app;
-        }
+        if (appId)
+            app = appSys.lookup_app('%s.desktop'.format(appId));
 
-        return null;
+        if (!app)
+            app = appSys.lookup_app('%s.desktop'.format(this.initialTitle));
+
+        return app;
     }
 
     setTitle(title) {